From b149c9299529f3acbcc0a7899723a5a410ba2052 Mon Sep 17 00:00:00 2001 From: robertl Date: Thu, 6 Apr 2006 06:02:39 +0000 Subject: [PATCH] Change 'NO_EXPAT' sense to HAVE LIBEXPAT in the last intrusive way in prep for autoconf. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@1826 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/cet_util.c | 8 +++++--- gpsbabel/cet_util.h | 5 ++++- gpsbabel/defs.h | 1 + gpsbabel/geo.c | 2 +- gpsbabel/google.c | 2 +- gpsbabel/gpx.c | 15 ++++++++++----- gpsbabel/hsa_ndv.c | 4 ++-- gpsbabel/kml.c | 2 +- gpsbabel/navicache.c | 4 ++-- gpsbabel/tef_xml.c | 2 +- gpsbabel/wfff_xml.c | 2 +- gpsbabel/xmlgeneric.c | 19 ++++++++++++++++++- 12 files changed, 47 insertions(+), 19 deletions(-) diff --git a/gpsbabel/cet_util.c b/gpsbabel/cet_util.c index a208f194b..1a50afbc6 100644 --- a/gpsbabel/cet_util.c +++ b/gpsbabel/cet_util.c @@ -24,12 +24,13 @@ #include #include #include +#include #include "defs.h" #include "cet.h" #include "cet_util.h" -#ifndef NO_EXPAT +#if HAVE_LIBEXPAT # include #endif @@ -112,7 +113,7 @@ cet_str_cp1252_to_utf8(const char *src) * * */ - +#if HAVE_LIBEXPAT int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *encoding, XML_Encoding *info) { cet_cs_vec_t *cs; @@ -143,6 +144,7 @@ int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *enc return XML_STATUS_OK; } +#endif char * @@ -1098,7 +1100,7 @@ int cet_vfprintf(FILE *stream, const cet_cs_vec_t *src_vec, const char *fmt, va_ int res, ct; va_list args2; /* vsnprintf makes args unusable for a second try */ - va_copy(args2, args); + __va_copy(args2, args); ct = vsnprintf(buff, sizeof(buff), fmt, args); if (ct >= (int)sizeof(buff)) { cout = xmalloc(ct + 1); diff --git a/gpsbabel/cet_util.h b/gpsbabel/cet_util.h index 402f76412..b3ce840a8 100644 --- a/gpsbabel/cet_util.h +++ b/gpsbabel/cet_util.h @@ -24,9 +24,10 @@ #include #include +#include "config.h" #include "cet.h" -#ifndef NO_EXPAT +#if HAVE_LIBEXPAT # include #endif @@ -88,7 +89,9 @@ extern cet_cs_vec_t cet_cs_vec_utf8; #endif #endif /* not defined XMLCALL */ +#if HAVE_LIBEXPAT int XMLCALL cet_lib_expat_UnknownEncodingHandler(void *data, const XML_Char *encoding, XML_Encoding *info); +#endif /* helpers */ diff --git a/gpsbabel/defs.h b/gpsbabel/defs.h index be2571d75..c639d0c3f 100644 --- a/gpsbabel/defs.h +++ b/gpsbabel/defs.h @@ -25,6 +25,7 @@ #include #include #include +#include "config.h" #include "queue.h" #include "gbtypes.h" #include "cet.h" diff --git a/gpsbabel/geo.c b/gpsbabel/geo.c index a92c71547..f50d446c7 100644 --- a/gpsbabel/geo.c +++ b/gpsbabel/geo.c @@ -37,7 +37,7 @@ arglist_t geo_args[] = { #define MYNAME "geo" #define MY_CBUF 4096 -#if NO_EXPAT +#if ! HAVE_LIBEXPAT static void geo_rd_init(const char *fname) { diff --git a/gpsbabel/google.c b/gpsbabel/google.c index 4fc499c2f..85dbab357 100644 --- a/gpsbabel/google.c +++ b/gpsbabel/google.c @@ -32,7 +32,7 @@ static int serial = 0; #define MYNAME "google" #define MY_CBUF 4096 -#if NO_EXPAT +#if ! HAVE_LIBEXPAT static void google_rd_init(const char *fname) { diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index 57fbb1694..bd9c583aa 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -23,7 +23,7 @@ #include "xmlgeneric.h" #include "cet_util.h" #include "garmin_fs.h" -#ifndef NO_EXPAT +#if HAVE_LIBEXPAT #include static XML_Parser psr; #endif @@ -1026,13 +1026,18 @@ gpx_end(void *data, const char *el) *s = 0; } -#if NO_EXPAT +#if ! HAVE_LIBEXPAT static void gpx_rd_init(const char *fname) { fatal(MYNAME ": This build excluded GPX support because expat was not installed.\n"); } +static void +gpx_rd_deinit(void) +{ +} + #else /* NO_EXPAT */ static void @@ -1126,7 +1131,6 @@ gpx_rd_init(const char *fname) XML_SetCharacterDataHandler(psr, gpx_cdata); fs_ptr = NULL; } -#endif static void @@ -1163,6 +1167,7 @@ gpx_rd_deinit(void) wpt_tmp = NULL; cur_tag = NULL; } +#endif static void gpx_wr_init(const char *fname) @@ -1182,7 +1187,7 @@ gpx_wr_deinit(void) void gpx_read(void) { -#ifndef NO_EXPAT +#if HAVE_LIBEXPAT int len; int done = 0; char *buf = xmalloc(MY_CBUF_SZ); @@ -1267,7 +1272,7 @@ gpx_read(void) } } xfree(buf); -#endif /* NO_EXPAT */ +#endif /* HAVE_LIBEXPAT */ } static void diff --git a/gpsbabel/hsa_ndv.c b/gpsbabel/hsa_ndv.c index 973e4538e..4bdf7b1a1 100644 --- a/gpsbabel/hsa_ndv.c +++ b/gpsbabel/hsa_ndv.c @@ -18,7 +18,7 @@ */ #include "defs.h" #include "cet_util.h" -#if !NO_EXPAT +#if HAVE_LIBEXPAT #include static XML_Parser psr; #endif @@ -53,7 +53,7 @@ arglist_t hsa_ndv_args[] = { #define FALSE 0 -#if NO_EXPAT +#if ! HAVE_LIBEXPAT static void hsa_ndv_rd_init(const char *fname) { diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index 41c7842a7..33eba0500 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -72,7 +72,7 @@ arglist_t kml_args[] = { #define MYNAME "kml" -#if NO_EXPAT +#if ! HAVE_LIBEXPAT static void kml_rd_init(const char *fname) { diff --git a/gpsbabel/navicache.c b/gpsbabel/navicache.c index 2608a9e27..8a2fe8a81 100644 --- a/gpsbabel/navicache.c +++ b/gpsbabel/navicache.c @@ -18,7 +18,7 @@ */ #include "defs.h" #include "cet_util.h" -#if !NO_EXPAT +#if HAVE_LIBEXPAT #include static XML_Parser psr; #endif @@ -40,7 +40,7 @@ arglist_t nav_args[] = { #define MYNAME "navicache" #define MY_CBUF 4096 -#if NO_EXPAT +#if ! HAVE_LIBEXPAT static void nav_rd_init(const char *fname) { diff --git a/gpsbabel/tef_xml.c b/gpsbabel/tef_xml.c index bcfa4054c..0fa364a66 100644 --- a/gpsbabel/tef_xml.c +++ b/gpsbabel/tef_xml.c @@ -42,7 +42,7 @@ static arglist_t tef_xml_args[] = #define MYNAME "TourExchangeFormat" -#if NO_EXPAT +#if ! HAVE_LIBEXPAT void tef_xml_rd_init(const char *fname) { diff --git a/gpsbabel/wfff_xml.c b/gpsbabel/wfff_xml.c index 647c51517..d20bd16c3 100644 --- a/gpsbabel/wfff_xml.c +++ b/gpsbabel/wfff_xml.c @@ -45,7 +45,7 @@ arglist_t wfff_xml_args[] = { #define MYNAME "wfff_xml" #define MY_CBUF 4096 -#if NO_EXPAT +#if ! HAVE_LIBEXPAT void wfff_xml_rd_init(const char *fname) { diff --git a/gpsbabel/xmlgeneric.c b/gpsbabel/xmlgeneric.c index f999fa0db..3aae2d0ab 100644 --- a/gpsbabel/xmlgeneric.c +++ b/gpsbabel/xmlgeneric.c @@ -23,7 +23,7 @@ #include "xmlgeneric.h" #include "cet_util.h" -#ifndef NO_EXPAT +#if HAVE_LIBEXPAT #include static XML_Parser psr; #endif @@ -207,6 +207,7 @@ xml_start(void *data, const char *el, const char **attr) } } +#if HAVE_LIBEXPAT static void xml_cdata(void *dta, const XML_Char *s, int len) { @@ -310,5 +311,21 @@ xml_deinit(void) } xg_ignore_taglist = NULL; } +#else /* HAVE_LIBEXPAT */ +void +xml_init(const char *fname, xg_tag_mapping *tbl, const char *encoding) +{ + fatal("This format does not support reading XML files as libexpat was not present."); +} + +void xml_read(void) +{ +} + +void xml_deinit(void) +{ +} + +#endif /* HAVE_LIBEXPAT */ /******************************************/ -- 2.30.2